package by.gravity.pvh.adapter;

import java.util.ArrayList;
import java.util.List;

import org.holoeverywhere.app.Fragment;

import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

public class PVHFragmentPagerAdapter extends FragmentStatePagerAdapter {

	private List<Fragment> fragments;

	private String[] titles;

	public PVHFragmentPagerAdapter(FragmentManager fm, String[] titles) {

		super(fm);
		this.fragments = new ArrayList<Fragment>();
		this.titles = titles;

	}

	@Override
	public Fragment getItem(int position) {

		return fragments.get(position);
	}

	@Override
	public int getCount() {

		return fragments.size();
	}

	public void addFragment(Fragment fragment) {

		fragments.add(fragment);
	}

	@Override
	public CharSequence getPageTitle(int position) {

		return titles[position];
	}

}
